/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 * Description: 获取动态库中profiling接口函数的适配接口私有头文件.
 * Author: zhangjian
 * Create: 2023-08-30
 */

#ifndef HCCL_SRC_DLPROFFUNC_H
#define HCCL_SRC_DLPROFFUNC_H

#include <functional>
#include <mutex>
#include <dlfcn.h>
#include <hccl/hccl_types.h>
#include "toolchain/prof_api.h"
#include "hccl/base.h"

namespace hccl {
class DlProfFunc {
public:
    virtual ~DlProfFunc();
    static DlProfFunc &GetInstance();
    HcclResult DlProfFunctionInit();
    std::function<uint64_t(void)> dlMsprofSysCycleTime{};

private:
    void *handle_{};
    std::mutex handleMutex_;
    DlProfFunc(const DlProfFunc&) = delete;
    DlProfFunc &operator=(const DlProfFunc&) = delete;
    DlProfFunc();
    HcclResult DlProfFunctionInterInit();
    void DlProfFunctionStubInit();
};
}  // namespace hccl
#endif
